cmake_minimum_required(VERSION 3.0)

project(test)

# set(CMAKE_BUILD_TYPE "Debug")


# c++ version
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# destination
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin")

# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
	message("Setting build type to 'RelWithDebInfo' as none was specified.")
	set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
	# Set the possible values of build type for cmake-gui
	set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
		"MinSizeRel" "RelWithDebInfo")
endif()

IF (CMAKE_BUILD_TYPE STREQUAL Release) #       用IF控制，可以实现Release版本不输出debug信息
	ADD_DEFINITIONS(-DNDEBUG)            #       不知道为什么DEBUG必须写成-DDEBUG，谁来解释一下吧
ENDIF()

# library type
set(LIB_TYPE OBJECT)

# # make sure out-of-source builds
# file(TO_CMAKE_PATH "${PROJECT_BINARY_DIR}/CMakeLists.txt" LOC_PATH)
# message( "there is the CMakeLists.txt :" ${LOC_PATH})
# if(EXISTS ".${LOC_PATH}")
# 	message(FATAL_ERROR "You cannot build in a source directory (or any directory with a CMakeLists.txt file). Please make a build subdirectory. Feel free to remove CMakeCache.txt and CMakeFiles.")
# endif()

################################
# compiler flags

# SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-DBOOST_LOG_DYN_LINK")
# SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g")
# SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

################################
# eigen3
# find_package(Eigen3 3.3)
# if(EIGEN3_FOUND)
# endif()

################################
# openmp

# FIND_PACKAGE(OpenMP)
# if(OPENMP_FOUND)
# 	ADD_DEFINITIONS(-DGEOXFEM_OPENMP)
# 	message("OPENMP FOUND")
# 	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
# 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
# 	set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
# endif()
################################
# boost

# set(Boost_NO_BOOST_CMAKE ON)
# find_package(Boost REQUIRED COMPONENTS log-mt log_setup-mt thread-mt date_time iostreams)
# if(Boost_FOUND)
# 	message("there is the boost head file :" ${Boost_INCLUDE_DIRS})
# 	message("there is the boost library:" ${Boost_LIBRARIES})
# 	include_directories(${Boost_INCLUDE_DIRS})
# else()
# 	message("Can't find the boost head file!")
# endif()

################################

add_subdirectory(src)
add_subdirectory(test)

add_executable(test main.cpp)

